<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
     	#my{
     		/* color: teal; */
     	}

     	body{
     		color: fuchsia;
     		background: silver;

     	}

	</style>
</head>
<body>
	<h1 id="my" text="fuchsia">换图片</h1>
	<img src="./1.jpg" onclick="onck(this)" />
</body>
<script type="text/javascript">
	function onck(obj){
		if(obj.index == undefined){
			obj.index = 2;
		}else{
			obj.index++;
			if(obj.index > 3){
				obj.index = 1;
			}
		}
		obj.src= obj.index + '.jpg';	
	}
</script>
</html>